Process Platform Workflow Plug-in |
The cordys.workflow plug-in is used to interact with the Process Platform Workflow engine. This plug-in can be used to perform activities such as workflow tasks and handling specific tasks. It uses the cordys.ajax plug-in to call the Web services.
Methods
The following methods are supported by the cordys.workflow plug-in:
Table 1. List of Methods
Method |
Description |
---|---|
addAttachment(task, attachmentName, fileName, description, content, options) |
Adds an attachment with its name, description, and content to the task |
claimTask(task, options) |
Claims a task assigned to the team of the user on the worklist |
completeTask(task, taskData, options) |
Completes a specified task |
delegateTask(task, userDN, memo, options) |
Delegates the specified task to another user |
getAllTargets(options) |
Retrieves all the targets (roles, teams, and worklists) of the current user |
getAttachments(task, options) |
Retrieves the attachments of the required task |
getPersonalTasks(options) |
Retrieves all the personal tasks assigned to the current user. The result set is sorted in descending order of the StartDate. |
getTaskDetails(task, options) |
Retrieves details of the specified task. It invokes the GetTask method from the Notification API. |
getTasks(options) |
Retrieves all the tasks of the current user or a specific target. The result set is sorted in descending order of the StartDate. |
getWorkLists(options) |
Retrieves the work lists of the current user |
pauseTask(task, taskData, options) |
Pauses the specified task |
removeAttachment(task, attachmentName, fileName, options) |
Removes a specific attachment from the required task |
resumeTask(task, taskData, options) |
Resumes the specified task |
revokeTask(task, taskData, options) |
Revokes the specified task |
skipTask(task, taskData, reason, options) |
Skips the specified task for a specified reason |
startTask(task, taskData, options) |
Starts the specified task |
stopTask(task, taskData, options) |
Stops the specified task |
suspendTask(task, taskData, options) |
Suspends the specified task |
Note:
- All the task parameters can either be a complete task object or a string containing the identifier of the task.
- All the options parameters are a collection of properties that are sent to the Process Platform Ajax Plug-in call. In this collection, you can provide specific parameters or a method to be invoked on completion.
- For more information on the Workflow APIs, refer Task APIs.
Return types
All methods in the workflow plug-in return a jQuery XHR object, which is the same as the object returned by the cordys.ajax.
Authentication
The cordys.ajax plug-in handles the authentication to connect to the Cordys server. For more information, refer to Authenticating Users with HTML5 SDK.
Examples
The following are the sample code snippets:
var taskModel = new $.cordys.model({ objectName: "Task", context: document.getElementById("taskView") }); $.cordys.workflow.getPersonalTasks().done(function(tasks) { taskModel.Task(tasks); });
$.cordys.workflow.getTasks({ parameters: { TaskIdentifiers: { TaskIdentifierType: { "@id": "15d5a9e3-f7c3-4a44-99cb-7146f478616c", "@name": "SalesOrder" } }, Criteria: { Query: "(Task.StartDate IS NULL OR Task.StartDate <=:sdate ) AND (Task.State =:tstate AND SalesOrder.Id like :id)", Parameters: { Parameter: { "@name": "tstate", "@type": "Task.State", "@value": "CREATED" }, Parameter: { "@name": "id", "@type": "SalesOrder.Id", "@value": "%1%" }, Parameter: { "@name": "sdate", "@type": "Task.StartDate", "@value": "2008-12-31T08:25:45.45" } } }, OrderBy: "SalesOrder.Id", AssignedBy: "cn=npraveen,cn=organizational users,o=system,cn=cordys,cn=signfp1,o=vanenburg.com", Target: { "@type": "worklist", text: "d9a48178-592c-453a-8d69-d7e13ca2bd78" }, ShowNonWorkableItems: "false", ReturnTaskData: "true" } });
$.cordys.workflow.completeTask(taskId, getData());